package com.ruoyi.web.controller.system;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.PwsStatus;
import com.ruoyi.system.domain.vo.InProductVo;
import com.ruoyi.system.domain.vo.ProductionStatusVo;
import com.ruoyi.system.domain.vo.TankAndPwsAndSapVo;
import com.ruoyi.system.service.PwsStatusService;
import io.swagger.annotations.Api;

import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * <p>
 * pws 前端控制器
 * </p>
 *
 * @author tianfu-li
 * @since 2025-44-27
 */
@RestController
@RequestMapping("/pwsStatus")
@Api(tags = "pws状态")
public class PwsStatusController {
    @Autowired
    private PwsStatusService pwsStatusService;
     @GetMapping("/getProductData")
     @ApiOperation("获取生产数据")
    public R<List<ProductionStatusVo>> getInProductData(){
         List<ProductionStatusVo> productionStatusInProductVoList = pwsStatusService.getProductData();
         return  productionStatusInProductVoList.size()==0?R.fail("查询失败！"):R.ok(productionStatusInProductVoList);
     }

    @GetMapping("/getTankAndPwsAndSapData")
    @ApiOperation("获取设备订单备料数据通过线号")
    public R<TankAndPwsAndSapVo> getTankAndPwsAndSapData(@RequestParam("lineNo") Long lineNo){
        TankAndPwsAndSapVo tankAndPwsAndSapVo = pwsStatusService.getTankAndPwsAndSapData(lineNo);
        return  tankAndPwsAndSapVo==null?R.fail("查询失败！"):R.ok(tankAndPwsAndSapVo);
    }

    @GetMapping("/getPwsStatusByOrderNo")
    @ApiOperation("获取pws状态通过订单号")
    public R<PwsStatus> getPwsStatusByOrderNo(@RequestParam("orderNo") String orderNo){
        PwsStatus pwsStatus = pwsStatusService.getPwsStatusByOrderNo(orderNo);
        return  pwsStatus==null?R.fail("查询失败！"):R.ok(pwsStatus);
    }

}
